test: verify firecracker fork-from-snapshot CoW isolation#214
Conversation
Adds TestFirecrackerForkFromSnapshot_DoesNotMutateSource. It puts a firecracker source into Standby, forks it, restores the fork, writes a divergent guest sentinel, then takes a diff snapshot of the fork. Across the fork's full lifecycle (and after the fork is deleted) the source's snapshot mem-file must keep the same inode and SHA-256, and the source must still be restorable with its pre-fork guest state. Includes a soft disk-usage check (gated on a FICLONE probe) that the fork lifecycle consumes substantially less than a full guest-mem copy on reflink-capable filesystems. This documents the CoW isolation properties of reflink-based fork-from- snapshot and guards against fan-out optimizations that would share an inode with the source's snapshot mem-file.
d46be7a to
7b799f7
Compare
355ad7f to
a45d471
Compare
a45d471 to
8b0000c
Compare
|
Firetiger deploy monitoring skipped This PR didn't match the auto-monitor filter configured on your GitHub connection:
Reason: PR modifies fork/snapshot memory file handling in the instances library, not API endpoints (packages/api/cmd/api/) or Temporal workflows (packages/api/lib/temporal) as specified in the filter. To monitor this PR anyway, reply with |
101b5bd to
0f0137b
Compare
0f0137b to
ac6bfde
Compare
|
Firetiger deploy monitoring skipped This PR didn't match the auto-monitor filter configured on your GitHub connection:
Reason: This PR adds an integration test for firecracker fork-from-snapshot behavior and does not modify kernel API endpoints (packages/api/cmd/api/) or Temporal workflows (packages/api/lib/temporal). To monitor this PR anyway, reply with |
Summary
Adds an integration test that documents and guards the CoW isolation properties of firecracker fork-from-snapshot. When a fork descends from a source's standby snapshot, the fork's mem-file must be a separate inode (reflink-cloned by
forkvm.CopyGuestDirectory) so that mutating the fork — including taking a diff snapshot after divergence — never affects the source.What the test does
TestFirecrackerForkFromSnapshot_DoesNotMutateSource(Linux-only, gated on/dev/kvm):snapshot-latest/memory(inode + SHA-256).guest_memon reflink-capable filesystems.The disk-usage assertion is gated on a runtime FICLONE probe; on ext4 and other non-reflink filesystems the copy falls back to sparse full-copy, so the "much-less-than-guest-mem" bound only holds on reflink-capable filesystems.
Test plan
TestFirecrackerForkFromSnapshot_DoesNotMutateSourceon linux/amd64